using System;

namespace ConsoleApplication
{
    public class VirtualScript
    {
        public static void Execute() {
            A p = new B();
            B p1 = new B();

            //new: 父类不改变
            p.Fun();
            p1.Fun();

            //override：父类改变
            p.Gun();
            p1.Gun();
        }


    }


    class A {
        public  void Fun() {
            Console.WriteLine("I am F in A");
        }

        public virtual void Gun() {
            Console.WriteLine("I am G in A");
        }
    }

    class B : A {
        new public void Fun() {
            Console.WriteLine("I am F in B");
        }

        public override void Gun() {
            Console.WriteLine("I am G in B");
        }
    }
}
